import request from "@/utils/request";

//获取广告分类列表
export const getCategoryList = props => {
  return request({
    url: "/mall/tenant/merchant/advertising/getCategoryList",
    method: "get",
    params: props
  });
};

//根据分类id获取广告列表
export const getAdvertList = props => {
  return request({
    url: `/mall/tenant/merchant/advertising/list/${props.advertisingCategoryId}`,
    method: "get"
  });
};

//新增广告信息
export const addAdvert = props => {
  return request({
    url: "/mall/tenant/merchant/advertising/add",
    method: "post",
    data: props
  });
};

//删除广告信息
export const delAdvert = props => {
  return request({
    url: `/mall/tenant/merchant/advertising/remove/${props.id}`,
    method: "post",
    data: props
  });
};

//修改广告信息
export const editAdvert = props => {
  return request({
    url: `/mall/tenant/merchant/advertising/edit/${props.advertisingId}`,
    method: "post",
    data: props
  });
};

//修改轮播时间
export const updateToggle = props => {
  return request({
    url: `/mall/tenant/merchant/advertising/updateToggle/${props.categoryId}?toggle=${props.toggle}`,
    method: "post"
    // data: { toggle: props.toggle }
  });
};

//拖拽更改排序
export const updateSort = props => {
  return request({
    url: "/mall/tenant/merchant/advertising/updateSort",
    method: "post",
    data: props
  });
};

//图片上传，存到业务端
export const imgsUpload = props => {
  return request({
    url: "/sass/file/upload",
    method: "post",
    data: props
  });
};

//获取运营平台广告模板
export const getTemplateList = props => {
  return request({
    url: `/mall/tenant/merchant/advertising/getTemplateList/${props.categoryId}`,
    method: "get"
  });
};

//获取商城配置信息 logo、icon
export const getLogoInfo = props => {
  return request({
    url: "/mall/tenant/merchant/advertising/getLogoInfo",
    method: "get",
    params: props
  });
};

//设置商城配置信息 logo、icon
export const editLogo = props => {
  return request({
    url: "/mall/tenant/merchant/advertising/editLogo",
    method: "post",
    data: props
  });
};
